package com.github.zxhtom.excel.utils;

import com.github.zxhtom.excel.model.Student;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.UUID;

/**
 * @package com.github.zxhtom.excel.utils
 * @Class ExportUtil
 * @Description 导出工具类
 * @Author zhangxinhua
 * @Date 19-10-31 下午3:49
 */
public class ExportUtil {

    private static Logger logger = LoggerFactory.getLogger(ExportUtil.class);

    private final static Integer STUDENT_NUMBER = 65530;

    private ExportUtil util = new ExportUtil();

    public ExportUtil getInstance() {
        return util;
    }

    public static List<Student> generateStudents() {
        logger.info("开始生产学生"+STUDENT_NUMBER+"：");
        List<Student> list = new ArrayList<>(STUDENT_NUMBER);
        for (Integer i = 0; i < STUDENT_NUMBER; i++) {
            Student student = Student.builder().id(UUID.randomUUID().toString()).userName(CreatNameUtil.getName()).userNick("烟花散尽13141")
                    .age(MathUtil.getInstance().getRandom(5, 28)).sex(MathUtil.getInstance().getRandom(1, 8) % 2 == 0 ? true : false)
                    .birth(DateUtil.getFrontDay(new Date(), MathUtil.getInstance().getRandom(800, 100000))).height(Double.valueOf(MathUtil.getInstance().getRandom(155, 190))).build();
            /*Student student = new Student();
            student.setId(UUID.randomUUID().toString()).setUserName(CreatNameUtil.getName())
                    .setAge(MathUtil.getInstance().getRandom(5, 28)).setSex(MathUtil.getInstance().getRandom(1, 8) % 2 == 0 ? true : false)
                    .setBirth(DateUtil.getFrontDay(new Date(), MathUtil.getInstance().getRandom(800, 100000))).setHeight(Double.valueOf(MathUtil.getInstance().getRandom(155, 190)));*/
            list.add(student);
        }
        return list;
    }
}
